/**
 * 
 */
package com.maywide.jdp.system.utils;

import java.beans.PropertyEditorSupport;


/**
 * @author luoyang
 *
 */
public class JSONEditor extends PropertyEditorSupport {
	@SuppressWarnings("rawtypes")
	private Class clazz = null;
	
	@SuppressWarnings("rawtypes")
	public JSONEditor(Class clazz) {
		this.clazz = clazz;
	}

	@SuppressWarnings("unchecked")
	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		setValue(JSONUtils.fromJson(text, clazz));
	}

}
